package console4.widgets;

import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.Charset;

public class CharsetTester {

	public static void main(String[] args) {
		for(Charset cs:Charset.availableCharsets().values()) {
			try {
				Process p=new ProcessBuilder("cmd.exe","/c","dir").directory(new File("C:\\")).start();
				InputStreamReader isr=new InputStreamReader(p.getInputStream(),cs);
				char c=' ';
				while(c!='\r') {
					c=(char)isr.read();
					System.out.print(c);
				}
				p.destroy();
				isr.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			System.out.println("\t->\t"+cs);
		}
	}

}
